package edu.cuc.akkaDay01.demo03;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.PoisonPill;
import akka.actor.Props;

/**
 * Created by bingruiqi on 2017/9/10.
 */
public class DeadMain {
    public static void main(String[] args) {
        ActorSystem system = ActorSystem.create();
        ActorRef worker = system.actorOf(Props.create(Myworker.class), "worker");
        system.actorOf(Props.create(WatchActor.class, worker), "watcher");
        worker.tell(Myworker.Msg.WORKING,ActorRef.noSender());
        worker.tell(Myworker.Msg.DONE,ActorRef.noSender());
        worker.tell(PoisonPill.getInstance(),ActorRef.noSender());
    }
}
